package net.maergaiyun.service;

import net.maergaiyun.controller.request.ShortLinkAddRequest;
import net.maergaiyun.controller.request.ShortLinkDelRequest;
import net.maergaiyun.controller.request.ShortLinkPageRequest;
import net.maergaiyun.controller.request.ShortLinkUpdateRequest;
import net.maergaiyun.model.EventMessage;
import net.maergaiyun.util.JsonData;
import net.maergaiyun.vo.ShortLinkVO;

import java.util.Map;

public interface ShortLinkService {
    /**
     * 解析短链
     *
     * @param shortLinkCode
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     *
     * @param shortLinkAddRequest
     * @return
     */
    JsonData createShortLink(ShortLinkAddRequest shortLinkAddRequest);

    /**
     * 分页查询短链
     *
     * @param request
     * @return
     */
    Map<String, Object> pageByGroupId(ShortLinkPageRequest request);

    /**
     * 删除短链
     *
     * @param request
     * @return
     */
    JsonData del(ShortLinkDelRequest request);

    /**
     * 更新短链
     *
     * @param request
     * @return
     */
    JsonData update(ShortLinkUpdateRequest request);

    /**
     * 处理新增短链消息
     *
     * @param eventMessage
     * @return
     */
    boolean handleAddShortLink(EventMessage eventMessage);

    /**
     * 处理删除短链消息
     *
     * @param eventMessage
     * @return
     */
    boolean handlerDelShortLink(EventMessage eventMessage);

    /**
     * 处理删除短链消息
     *
     * @param eventMessage
     * @return
     */
    boolean handlerUpdateShortLink(EventMessage eventMessage);
}
